package com.simple.gateway.core.mapping;

import com.simple.gateway.core.datasource.DataSourceType;

/**
 * 项目: simple-gateway-core
 *
 * 功能描述: http语句
 *
 * @author: WuChengXing
 *
 * @create: 2023-08-04 10:47
 **/
public class HttpStatement {

    /**
     * 应用名称；
     */
    private final String application;

    /**
     * 服务接口；RPC、其他
     */
    private final String interfaceName;

    /**
     * 服务方法；RPC#method
     */
    private final String methodName;

    /**
     * 参数类型(RPC 限定单参数注册)；new String[]{"java.lang.String"}、new String[]{"com.simple.gateway.test.provider.rpc.dto.UserRequestDTO"}
     */
    private final String parameterType;

    /**
     * 网关接口
     */
    private final String uri;

    /**
     * 接口类型；GET、POST、PUT、DELETE
     */
    private final HttpCommandType httpCommandType;

    /**
     * 是否鉴权；true = 是、false = 否
     */
    private final boolean auth;

    /**
     * 鉴权的类型，支持SPI实现
     */
    private String authType;

    /**
     * 此次请求的类型
     */
    private final DataSourceType dataSourceType;

    public HttpStatement(String application, String interfaceName, String methodName, String parameterType, String uri, HttpCommandType httpCommandType, boolean auth, DataSourceType dataSourceType) {
        this.application = application;
        this.interfaceName = interfaceName;
        this.methodName = methodName;
        this.parameterType = parameterType;
        this.uri = uri;
        this.httpCommandType = httpCommandType;
        this.auth = auth;
        this.dataSourceType = dataSourceType;
    }

    public String getApplication() {
        return application;
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public String getMethodName() {
        return methodName;
    }

    public String getUri() {
        return uri;
    }

    public HttpCommandType getHttpCommandType() {
        return httpCommandType;
    }

    public String getParameterType() {
        return parameterType;
    }

    public boolean isAuth() {
        return auth;
    }

    public String getAuthType() {
        return authType;
    }

    public DataSourceType getDataSourceType() {
        return dataSourceType;
    }
}
